﻿using System;
using MyHealthByDesign.Helper;

namespace MyHealthByDesign.Views
{
    /// <summary>
    /// Description:
    /// Displays thank you page
    /// 
    /// Author: Sanjeev Shrestha
    /// Date Created: 10/31/2011
    /// 
    /// Other code files referenced:
    /// None.
    /// 
    /// Regression Test Information:
    /// None.
    /// 
    /// Revision History:
    /// 11/03/2011 Sanjeev Shrestha - add logic for button
    /// 
    /// 
    /// Known Faults:
    /// None.
    /// </summary>
    public partial class ThankYou : System.Web.UI.Page
    {
        Domain.Domain domain = new Domain.Domain();

        /// <summary>
        /// Page Load event handler - check if user is logged in, and determines message
        /// to display based on form needed
        /// 
        /// PreConditions:
        /// None
        /// 
        /// PostConditions:
        /// Page displayed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!domain.IsUserLoggedIn())
            {
                Response.Redirect("../Default.aspx");
            }

            if (domain.IsEligibileForParq())
            {
                ltrQuestionnaire.Text = Constants.PARQ + ".";
                hyplnkQuestionnaire.Text = "Why do I need to fill out the " + Constants.PARQ + "?";
                hyplnkQuestionnaire.NavigateUrl = "Help/WhyParQ.htm";
                btnQuestionnaire.Text = "Continue to the " + Constants.PARQ + ".";
            }
            else
            {
                ltrQuestionnaire.Text = Constants.AHA + ".";
                hyplnkQuestionnaire.Text = "Why do I need to fill out the " + Constants.AHA + "?";
                hyplnkQuestionnaire.NavigateUrl = "Help/WhyAha.htm";
                btnQuestionnaire.Text = "Continue to the " + Constants.AHA + ".";
            }
        }

        /// <summary>
        /// Button click event handler - redirects based on logic
        /// 
        /// PreConditions:
        /// None
        /// 
        /// PostConditions:
        /// Page displayed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnQuestionnaire_Click(object sender, EventArgs e)
        {
            Response.Redirect(domain.IsEligibileForParq() ? "ParQ.aspx" : "Aha.aspx");
        }
    }
}